#ifndef PIECHART_H
#define PIECHART_H
#include <QtQuick/QQuickItem>
#include "pieslice.h"

class PieChart : public QQuickItem
{
    Q_OBJECT
    Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices) 
        //注册一个PieSlice列表属性
    Q_PROPERTY(QString name READ name WRITE setName)
        //注册一个name属性
public:
    PieChart(QQuickItem *parent = 0);

    QString name() const;
    void setName(const QString &name);

    QQmlListProperty<PieSlice> slices();
        //
private:
    static void append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice);

    QString m_name;
    QList<PieSlice *> m_slices;
    //PieSlice ps;
};

#endif
